package com.idol.website.controller;

import com.idol.framework.annotation.AutoWired;
import com.idol.framework.annotation.Controller;
import com.idol.framework.annotation.RequestMapping;
import com.idol.framework.annotation.Security;
import com.idol.website.service.IDemoService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Supreme_Sir
 * @version 1.0
 * @className DemoController
 * @description
 * @date 2020/10/31 22:37
 **/
@Controller
@RequestMapping("/demo")
public class DemoController {
    @AutoWired
    private IDemoService demoService;

    @RequestMapping("/query")
    @Security({"zhangSan"})
    public void getName(HttpServletRequest req, HttpServletResponse resp, String name) throws IOException {
        resp.getWriter().write("查询用户名：" + demoService.getName(name));
        return;
    }

    @RequestMapping("/insert")
    @Security({"liSi"})
    public void insertName(HttpServletRequest req, HttpServletResponse resp, String name) throws IOException {
        resp.getWriter().write("添加用户名：" + demoService.getName(name));
        return;
    }

    @RequestMapping("/delete")
    @Security({"wangWu"})
    public void deleteName(HttpServletRequest req, HttpServletResponse resp, String name) throws IOException {
        resp.getWriter().write("删除用户名：" + demoService.getName(name));
        return;
    }

    @RequestMapping("/modify")
    @Security({"zhaoLiu"})
    public void modifyName(HttpServletRequest req, HttpServletResponse resp, String name) throws IOException {
        resp.getWriter().write("修改用户名：" + demoService.getName(name));
        return;
    }
}
